package com.fh.area.controller;/**
 * 描述:
 * Author:袁亚强
 * Date:2021/12/149:06
 */

import com.fh.area.entity.vo.AreaVo;
import com.fh.area.service.AreaService;
import com.fh.common.baseData.TongyiData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * created by macro on 2021/12/14,
 */
@RestController
@RequestMapping("area")
public class AreaController {
    @Autowired
    private AreaService areaService;

    @PostMapping("queryById")
    private TongyiData queryById(String token) {
        return TongyiData.succeess(areaService.qeuryById(token));
    }

    @PostMapping("queryAreaById")
    private TongyiData queryAreaById(Integer id) {
        return TongyiData.succeess(areaService.queryAreaById(id));
    }

    @PostMapping("upArea")
    private TongyiData upArea(AreaVo areaVo) {
        areaService.upArea(areaVo);
        return TongyiData.succeess("");
    }

    @PostMapping("del")
    private TongyiData del(Integer id) {
        areaService.del(id);
        return TongyiData.succeess("");
    }
    @PostMapping("add")
    private TongyiData add(AreaVo areaVo) {
        areaService.add(areaVo);
        return TongyiData.succeess("");
    }

    @PostMapping("queryToken")
    private TongyiData queryToken(String token) {

        return TongyiData.succeess(areaService.queryToken(token));
    }


    @GetMapping("queryAllArea")
    public TongyiData queryAllArea() {
        return TongyiData.succeess(areaService.queryArea());
    }

    @PostMapping("queryName")
    private TongyiData queryName(AreaVo areaVo) {

        return TongyiData.succeess(areaService.queryName(areaVo));
    }


}
